<?php

namespace App\Library\Common;

class DateTool
{
    public static function isDate($date): bool
    {
        $date = (string)$date;
        if (10 != strlen($date)) {
            return false;
        }
        return date('Y-m-d', strtotime($date)) === $date;
    }

    public static function prefix()
    {
        return '[' . date('Y-m-d H:i:s') . ' UTC+8]';
    }

    public static function cnWeekOfDay(int $weekOfDay): string
    {
        $week = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
        return $week[$weekOfDay % 7];
    }
}
